Jump to content

Streaming over MoQ

From RidgeRun Developer Wiki


Follow us on: YouTube Twitter LinkedIn Email Share this page

Share This Page



Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help .

Using RidgeRun's MoQ

GstMoQ brings Media over QUIC (MoQ) streaming capabilities directly into GStreamer pipelines, enabling modern, low-latency, and scalable media delivery over QUIC / HTTP-3. Designed for next-generation media transport, GstMoQ allows developers to publish and subscribe to audio and video streams , ideal for edge, and AI-driven systems.

Setup

To install gst-moq library follow instructions to install

dependencies and building the plugin. On Step 4 of building the plugin, change the plugin path to:

export PREFIX=$HOME/.local
export GST_PLUGIN_PATH="$PREFIX/lib/aarch64-linux-gnu/gstreamer-1.0:${GST_PLUGIN_PATH}"

After installation, if you start a new sesion you always need to export the environment:

export GST_PLUGIN_PATH=$HOME/gst-plugins-rs/target/release
cd gst-rrmoq
export PREFIX=$HOME/.local
export GST_PLUGIN_PATH="$PREFIX/lib/aarch64-linux-gnu/gstreamer-1.0:${GST_PLUGIN_PATH}"

Pipeline Testing

Single track video streaming with local relay

On board side

BOARD_IP=X.X.X.X

and, then, choose one source:

Stream videotestsrc
gst-launch-1.0 rrmoqbin channel=test-video name=bin relay-server-host-addr=http://$BOARD_IP:4443 sink_0::track-name=video videotestsrc is-live=true ! videoconvert ! x264enc ! queue ! bin.sink_0
Stream camera
gst-launch-1.0 rrmoqbin channel=test-video name=bin relay-server-host-addr=http://$BOARD_IP:4443 sink_0::track-name=video qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse ! queue ! bin.sink_0
Stream from file
gst-launch-1.0 rrmoqbin channel=test-video name=bin relay-server-host-addr=http://$BOARD_IP:4443 sink_0::track-name=video filesrc location=camera-test.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=dmabuf output-io-mode=dmabuf ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc ! h264parse ! queue ! bin.sink_0

On host side

BOARD_IP=X.X.X.X
gst-launch-1.0 rrmoqsrc relay-url=http://$BOARD_IP:4443 channel=test-video name=src   src.video ! decodebin ! videoconvert ! autovideosink

Multiple track video streaming with local relay

Send all videos at the same time

On board side

gst-launch-1.0 -v \
  rrmoqbin relay-mode=local relay-server-host-addr=https://$BOARD_IP:4443 name=moq channel=test \
    sink_0::track-name=video1 sink_0::channel=test sink_1::track-name=video2 sink_1::channel=test sink_2::track-name=video3 sink_2::channel=test  \
  videotestsrc is-live=true pattern=smpte  ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! h264parse ! queue ! moq.sink_0 \
  qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse ! queue  ! moq.sink_1 \
  filesrc location=camera-test.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=dmabuf output-io-mode=dmabuf ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc ! h264parse ! queue ! moq.sink_2

On host side

Change to src.video1, src.video2 and src.video3

gst-launch-1.0 rrmoqsrc relay-url=http://$BOARD_IP:4443 channel=test name=src   src.video3 ! decodebin ! videoconvert ! autovideosink

Performance

The performance of this element was measured using the camera with different resolutions and NV21 format. This is the test pipeline:

gst-launch-1.0 rrmoqbin channel=test-video name=bin relay-server-host-addr=http://$BOARD_IP:4443 sink_0::track-name=video qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=$WIDTH,height=$HEIGHT,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse ! queue ! perf print-cpu-load=1 ! fakesink

Performance results

Resolution %MEM RSS (KB) BPS Mean BPS FPS Mean FPS CPU (%)
1280x720 0.2 75796 1999272.000 2056740.444 29.964 29.902 13
1920x1080 0.2 77504 10430992.000 9788049.000 30.200 29.930 13
3840x2160 0.2 86884 25313248.000 25135858.857 30.017 29.952 13

Element latency

Latency Summary with camera at 720p
element count avg_ms min_ms max_ms p50_ms p90_ms p95_ms p99_ms
v4l2h264enc0 113 3.170 2.504 9.882 3.176 3.329 3.456 3.529
queue0 113 0.363 0.055 0.758 0.387 0.622 0.644 0.682
queue1 113 0.164 0.036 0.619 0.091 0.454 0.519 0.549
h264parse0 113 0.127 0.092 0.400 0.112 0.174 0.189 0.272
capsfilter0 113 0.081 0.055 0.127 0.081 0.088 0.114 0.122
capsfilter1 113 0.071 0.047 0.122 0.065 0.097 0.106 0.116
perf0 113 0.069 0.033 0.426 0.059 0.088 0.155 0.333
Total Average Summary
metric value
TOTAL_AVG_SUM_MS 4.045
TOTAL_AVG_SUM_NS 4044803

Cookies help us deliver our services. By using our services, you agree to our use of cookies.